<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        fn(30,40,13)
        
        function fn(n1 , n2 , n3){
            var temp = 0; //定义一个中间变量
            if(n1 < n2 && n1 < n3){ //先假设n1时最小的
                if(n2 < n3){ //再比较n2和n3的大小
                    console.log(n1 + ',' + n2 + ',' + n3)
                }else{
                    console.log(n1 + ',' + n3 + ',' + n2)
                }
            }
            if(n2 < n1 && n2 < n3){ //先假设n2时最小的
                if(n1 < n3){ //再比较n1和n3的大小
                    console.log(n2 + ',' + n1 + ',' + n3)
                }else{
                    console.log(n2 + ',' + n3 + ',' + n1)
                }
            }else{
                if(n1 < n2){ //n3最小，接着来比较n1和n2的大小
                    console.log(n3 + ',' + n1 + ',' + n2)
                }else{
                    console.log(n3 + ',' + n2 + ',' + n1)
                }
            }
        }
    </script>
</body>
</html>